﻿@implements IDisposable

<MudGrid>
    <MudItem md="4">
        <MudButton OnClick="ScreenAPI" Variant="Variant.Filled" StartIcon="@Icons.Material.Filled.Colorize" Color="Color.Error">
            Window Screen Color Depth
        </MudButton>
    </MudItem>
    <MudItem md="12">
        <MudText id="Result" Typo="Typo.h6">Screen API</MudText>
    </MudItem>
</MudGrid>

@code {

    private async Task ScreenAPI()
    {
        try
        {
            var data = await Screen.ColorDepthAsync();
            await Dom.QuerySelector("#Result").TextAsync("Screen Color Depth: " + data.ToString());
        }
        catch (Exception ex)
        {
            Snackbar.Add($"{DashboardResource.StringError} : {ex.ToString()}", Severity.Error);
        }
    }

    public async void Dispose() => await Dom.DisposeAsync();
}
